Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Cannot seem to change password length validations

#12

The code is found in lib/authentication/by_password.rb - it says 6..40

I need it to be 8..40. Obviously i could just change it there, but i don't really want to do that, since we like to use submodules and everyone would need to make the change.

Ideally i'd like it to be set in the model. I tried just entering it there, but Rails seems to run both validations rather than overriding the by_password.rb one.

I have a solution which 'works' but doesn't feel very nice. You can see it at http://github.com/sermoa/restful...

Thanks for your help! Aimee.

Reported by sermoa · August 26th, 2008 @ 03:33 PM

State: open
Milestone: none
Assigned to: mrflip mrflip

Activity

  1. mrflip
    mrflip
    • State changed from new to open

    Would you consider changing it to use mattr_accessor -- see lib/authentication.rb for example usage? I think that's the rails-ier way you want. The only changes at the plugin level would be in lib/authentication/by_password.rb and you could ditch the methods.

    Figuring out the scope might make it complicated, and I can make the change if it gives you trouble.

    (more on mattr_accessor: http://toolmantim.com/article/20...

    Thanks for the patch!

    August 26th, 2008 @ 04:07 PM

  2. sermoa
    sermoa

    Hmm, i am trying to change it to mattr_accessor like you suggest ...

    It does not seem to work because you need to load the module before you can set the value, but in loading the module you also end up setting up the validation, before getting a chance to override it.

    It is a catch-22, is it not?

    August 26th, 2008 @ 04:36 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.